using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Backend.JYD.Model.Bid;

namespace Backend.JYD.EFDAL.Mapping
{
    public class BidRecordMap : EntityTypeConfiguration<BidRecord>
    {
        public BidRecordMap()
        {
            // Primary Key
            this.HasKey(t => new { t.BidId });

            // Properties
            this.Property(t => t.BidId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.InviteId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.UserId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.LoanMoney)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Term)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Rate)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Remark)
                .HasMaxLength(500);

            // Table & Column Mappings
            this.ToTable("BidRecord");
            this.Property(t => t.BidId).HasColumnName("BidId");
            this.Property(t => t.InviteId).HasColumnName("InviteId");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.AccId).HasColumnName("AccId");
            this.Property(t => t.LoanMoney).HasColumnName("LoanMoney");
            this.Property(t => t.Term).HasColumnName("Term");
            this.Property(t => t.Rate).HasColumnName("Rate");
            this.Property(t => t.Remark).HasColumnName("Remark");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.NextIncome).HasColumnName("NextIncome");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OpId).HasColumnName("OpId");
        }
    }
}
